package com.zimo.web.ctl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.zimo.web.entity.Weight;
import com.zimo.web.service.WeightService;


@Controller
@RequestMapping(value="w")
public class WeightController {

    private Logger log = Logger.getLogger(WeightController.class);
    
    @Resource
    private WeightService weightService;
    
    @RequestMapping("/byname.htm")
    public String getWeightListByName(ModelMap model,@RequestParam("u_name") String uName){
        
        List<Weight> list = weightService.getWeightListByName(uName);
        log.info("list size:["+(list!=null?list.size():0)+"]");
        model.addAttribute("list", list);
        return "weight/myweight.html";
    }
    
    @RequestMapping("/index.htm")
    public String weight(){
        log.info("*********index********");
        return "weight.html";
    }
    
}
